/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans.forms;

import datamodel.Category;
import ejb.CategoryManager;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author eXtreme
 */
@ManagedBean
@RequestScoped
public class NewCategoryForm {

    private String name;
            
    @EJB
    private CategoryManager cm;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public String saveCategory(){
        Category c = new Category(name);
        cm.saveCategory(c);
        return "categoryList?faces-redirect=true";
    }
}
